package com.strongdigit.ioc.aware;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;


public class MoocBeanName implements BeanNameAware, ApplicationContextAware {

    private String beanNam;

    @Override
    public void setBeanName(String name) {
        this.beanNam = name;
        System.out.println("setBeanName:" + name);

    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("setApplicationContext:" + applicationContext.getBean(this.beanNam).hashCode());

    }
}
